import { createStore } from 'vuex'

import createPersistedstate from 'vuex-persistedstate'

import cart from './modules/cart'
import user from './modules/user'
import category from './modules/category'

export default createStore({
  modules: {
    cart, user, category
  },
  // 配置插件的地方
  plugins: [createPersistedstate({ // 插件默认存储在locastorage上
    // 设置本地存储key值
    key: 'erabbit-client-pc',
    paths: ['user', 'cart'] // 指定要存储的模块
  })] // plugins是vuex自带的
})
